package com.kzj.mls.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.kzj.mls.R;
import com.kzj.mls.beans.CloseActivityBean;
import com.kzj.mls.beans.OrderBean;
import com.kzj.mls.recyclerCard.basic.MaterialListView;
import com.kzj.mls.recyclerCard.basic.OnButtonPressListener;
import com.kzj.mls.recyclerCard.card.Card;
import com.kzj.mls.recyclerCard.card.other.PaySuccessCard;
import com.umeng.analytics.MobclickAgent;

import de.greenrobot.event.EventBus;

/**
 * Created by xyg on 2015/11/3.
 */
public class PaySuccessActivity extends GBaseActivity {
    private MaterialListView material_listview;
    private OrderBean orderBean;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setContentViewFor720_1280(R.layout.template_materlistview);
        findViewByIds();
        initDatas();
        fillArrayInListView();
    }

    @Override
    protected void findViewByIds() {
        material_listview = (MaterialListView) findViewById(R.id.material_listview);
    }

    @Override
    protected void initDatas() {
        setTopTitle("支付成功");
        setLeftImg(View.VISIBLE, R.drawable.back);
        orderBean = (OrderBean) getIntent().getSerializableExtra("order_bean");
        EventBus.getDefault().register(this);
    }

    @Override
    protected void fillArrayInListView() {
        material_listview.setBackgroundResource(R.color.white);
        PaySuccessCard paySuccessCard = new PaySuccessCard(this);
        paySuccessCard.setOnNormalButtonPressedListener(new OnButtonPressListener() {
            @Override
            public void onButtonPressedListener(View view, Card card) {

            }
        });
        material_listview.add(paySuccessCard);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }
    public void onEventMainThread(CloseActivityBean closeActivityBean) {
        this.finish();
    }
    public void onResume() {
        super.onResume();
        MobclickAgent.onPageStart(getClass().getSimpleName()); //统计页面(仅有Activity的应用中SDK自动调用，不需要单独写)
        MobclickAgent.onResume(this);          //统计时长
    }
    public void onPause() {
        super.onPause();
        MobclickAgent.onPageEnd(getClass().getSimpleName()); // （仅有Activity的应用中SDK自动调用，不需要单独写）保证 onPageEnd 在onPause 之前调用,因为 onPause 中会保存信息
        MobclickAgent.onPause(this);
    }
}
